package com.ruoyi.web.controller.wuchuan;

import com.ruoyi.wuchuan.domain.ResultData;
import com.ruoyi.wuchuan.domain.WorkTask;
import com.ruoyi.wuchuan.service.HomeworkTaskService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * 作业任务
 */
@Controller
@RequestMapping("homeworkTaskController")
public class HomeworkTaskController {

    @Resource
    private HomeworkTaskService  homeworkTaskService;

    /**
     * 添加作业任务
     * @param workTask
     * @return
     */
    @RequestMapping(value = "addWorkTask", method = RequestMethod.POST)
    @ResponseBody
   public ResultData addWorkTask(@RequestBody WorkTask workTask){
        return homeworkTaskService.addWorkTask(workTask);
   }

    /**
     * 删除作业任务
     * @param workTask
     * @return
     */
    @RequestMapping(value = "delWorkTask", method = RequestMethod.POST)
    @ResponseBody
   public Boolean delWorkTask(@RequestBody WorkTask workTask){
        return homeworkTaskService.delWorkTask(workTask);
   }

    /**
     * 修改作业任务
     * @param workTask
     * @return
     */
    @RequestMapping(value = "editWorkTask", method = RequestMethod.POST)
    @ResponseBody
    Boolean editWorkTask(@RequestBody WorkTask workTask){
        return homeworkTaskService.editWorkTask(workTask);
    }

    /**
     * 根据名称模糊查询作业任务
     * @param workTask
     * @return
     */
    @RequestMapping(value = "queryWorkTaskByName", method = RequestMethod.POST)
    @ResponseBody
   public List<WorkTask> queryWorkTaskByName(@RequestBody WorkTask workTask){
       return homeworkTaskService.queryWorkTaskByName(workTask);
   }
}
